//
//  UIView+BFCurrentController.m
//  BFoodSystem
//
//  Created by 浙江择富 on 2018/3/14.
//  Copyright © 2018年 陈名正. All rights reserved.
//

#import "UIView+BFCurrentController.h"

@implementation UIView (BFCurrentController)

/** 获取当前View的控制器对象 */
-(UIViewController *)getCurrentViewController{
    
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *nextResponser = [next nextResponder];
        if ([nextResponser isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nextResponser;
        }
    }
    return nil;
}

@end
